package com.mind.adjust.service.impl;

import com.mind.system.domain.AjHandleComment;
import com.mind.adjust.mapper.AjHandleCommentMapper;
import com.mind.adjust.service.AjHandleCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 处理意见(AjHandleComment)表服务实现类
 *
 * @author makejava
 * @since 2024-08-28 14:15:05
 */
@Service("handleCommentService")
public class AjHandleCommentServiceImpl implements AjHandleCommentService {
    @Autowired
    private AjHandleCommentMapper handleCommentMapper;

    /**
     * 查询处理意见信息集合
     * 
     * @param handleComment 处理意见信息
     * @return 处理意见信息集合
     */
    @Override
    public List<AjHandleComment> selectHandleCommentList(AjHandleComment handleComment)
    {
        return handleCommentMapper.selectHandleCommentList(handleComment);
    }

    /**
     * 通过处理意见ID查询处理意见信息
     * 
     * @param handleCommentId 处理意见ID
     * @return 角色对象信息
     */
    @Override
    public AjHandleComment selectHandleCommentById(Long handleCommentId)
    {
        return handleCommentMapper.selectHandleCommentById(handleCommentId);
    }

    /**
     * 删除处理意见信息
     * 
     * @param handleCommentId 处理意见ID
     * @return 结果
     */
    @Override
    public int deleteHandleCommentById(Long handleCommentId)
    {
        return handleCommentMapper.deleteHandleCommentById(handleCommentId);
    }

    /**
     * 批量删除处理意见信息
     * 
     * @param handleCommentIds 需要删除的处理意见ID
     * @return 结果
     */
    @Override
    public int deleteHandleCommentByIds(Long[] handleCommentIds)
    {
        return handleCommentMapper.deleteHandleCommentByIds(handleCommentIds);
    }

    /**
     * 新增保存处理意见信息
     * 
     * @param handleComment 处理意见信息
     * @return 结果
     */
    @Override
    public int insertHandleComment(AjHandleComment handleComment)
    {
        return handleCommentMapper.insertHandleComment(handleComment);
    }

    /**
     * 修改保存处理意见信息
     * 
     * @param handleComment 处理意见信息
     * @return 结果
     */
    @Override
    public int updateHandleComment(AjHandleComment handleComment)
    {
        return handleCommentMapper.updateHandleComment(handleComment);
    }
    
    /**
     * 批量插入
     *
     * @param handleCommentList 附件类型信息
     * @return 结果
     */
    @Override
    public int batchInsert(List<AjHandleComment> handleCommentList) {
        int size = 0;
        for(AjHandleComment handleComment: handleCommentList) {
            if (handleCommentMapper.selectHandleCommentByName(handleComment.getName()) == null){
                handleCommentMapper.insertHandleComment(handleComment);
                size ++;
            }
        }
        return size;
    }
}
